/* 
 * File:   Font.h
 * Author: artem
 *
 * Created on November 20, 2011, 3:23 PM
 */

#ifndef FONT_H
#define FONT_H

#include "Common.h"

#include "Texture.h"
#include "Resource/FontDesc.h"

namespace Render
{
	class Font
	{
	public:
		Font(): m_texture(NULL)
		{
			m_texture = new Texture;
		}
		
		Font(const char *name): m_texture(NULL)
		{
			ASSERT(name);
			m_texture = new Texture;
			if (Resource::FontDesc *font = Resource::loadFontDesc(name))
			{
				if (!setData(font))
					LOG_ERROR("Can't load font '%s'\n", name);
				delete font;
			}
		}
		
		~Font()
		{
			delete m_texture;
		}
		
		const Resource::FontHead& getFont() const { return m_font; }
		const Texture* getTexture() const { return m_texture; }
		
		bool setData(const Resource::FontDesc *font);
		
	protected:
		Resource::FontHead m_font;
		Texture *m_texture;
	};
}

#endif /* FONT_H */
